<div>
  <form class="form-horizontal" role="form" novalidate name="stForm" ng-init="initQuery()">
    <div class="form-ctrl md-whiteframe-z1">
      <div class="form-search" style="height:270px;" ng-class="{true: 'shou'}[flagObj.shoumun.flag==0]" ng-switch on="translate.timeTypeCode.timeTypeCode">
        <div>
          <label style="width:70px">银行</label>
          <md-select ng-model="translate.bankCode" >
            <md-option ng-value="bank.bankCode" ng-repeat="bank in banks">{{bank.bankName}}</md-option>
          </md-select>
        </div>
        <div>
          <label style="width:70px">省公司</label>
          <md-select multiple ng-model="translate.provinceCode" >
            <md-select-label>
              {{translate.provinceCode.length ? _getNames(translate.provinceCode,'provinceName',provinces) :'全部'}}
            </md-select-label>
            <md-option ng-value="" ng-click="_checkAll(translate,'provinceCode')">全部</md-option>
            <md-option ng-value="item" ng-repeat="item in provinces">{{item.provinceName}}</md-option>
          </md-select>
        </div>
        <div>
          <label style="width:70px">接入渠道</label>
          <md-select multiple ng-model="translate.signChannelCode" ng-click="signChannelQuery()">
            <md-select-label>
            {{translate.signChannelCode.length ? _getNames(translate.signChannelCode,'channelName',response.data.signChannelList) :'全部'}}
            </md-select-label>
            <md-option ng-value="" ng-click="_checkAll(translate,'signChannelCode')">全部</md-option>
            <md-option ng-value="channel" ng-repeat="channel in response.data.signChannelList" >{{channel.channelName}}</md-option>
          </md-select>
        </div>
        <div>
          <label style="width:70px">交易类型</label>
          <md-select  multiple ng-model="translate.tradeTypeCode" >
            <md-select-label>
            {{translate.tradeTypeCode.length ? _getNames(translate.tradeTypeCode,'tradeTypeName',tradeTypes):'全部'}}
            </md-select-label>
            <md-option ng-value="" ng-click="_checkAll(translate,'tradeTypeCode');checkTrade()">全部</md-option>
            <md-option ng-value="tradeType" ng-repeat="tradeType in tradeTypes" ng-click='checkTrade()' >{{tradeType.tradeTypeName}}</md-option>
          </md-select>
        </div>
        <div>
          <label style="">账期</label>
          <md-select ng-model="translate.timeTypeCode">
            <md-select-label >
                {{translate.timeTypeCode ? translate.timeTypeCode.timeTypeName :'日'}}
            </md-select-label>
            <md-option ng-value="item" ng-repeat="item in timeTypes" >{{item.timeTypeName}}</md-option>
          </md-select>
        </div>
        <input-quarter-group ng-switch-when="4" name ='quarter' start-time ='translate.year.startTime' end-time ='translate.year.endTime' ></input-quarter-group>

        <div ng-if=" translate.timeTypeCode.timeTypeCode !== '4'">
          <md-input-container flex>
            <label >开始时间</label>
            <input name="dateStartTime" type="date" time-validate ='day' end-time="translate.endTime" ng-model="translate.startTime"  ng-switch-default required>
            <div ng-messages="stForm.dateStartTime.$error">
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">{{errorInfo.startTime[0]}}</div>
              <div ng-message="too-great">{{errorInfo.startTime[1]}}</div>
            </div>
            <input name="monthStartTime" time-validate ='month' ng-model="translate.startTime"  end-time="translate.endTime" type="month" ng-switch-when="3" required>
            <div ng-messages="stForm.monthStartTime.$error">
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">{{errorInfo.startTime[0]}}</div>
              <div ng-message="too-great">{{errorInfo.startTime[1]}}</div>
            </div>
            <input ng-model="translate.year.startTime"  time-validate ='year' end-time="translate.year.endTime" type="number" ng-switch-when="5" name='startYear' required>
            <div ng-messages="stForm.startYear.$error">
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">{{errorInfo.startTime[0]}}</div>
               <div ng-message="too-great">{{errorInfo.startTime[1]}}</div>
            </div>
          </md-input-container >
        </div>
        <div ng-if="translate.timeTypeCode.timeTypeCode !== '4'">
          <md-input-container flex>
            <label>结束时间</label>
            <input name="dateEndTime" time-validate ='day' type="date" ng-model="translate.endTime"  start-time="translate.startTime" ng-switch-default required>
            <div ng-messages="stForm.dateEndTime.$error">
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">{{errorInfo.endTime[0]}}</div>
              <div ng-message="too-great">{{errorInfo.endTime[1]}}</div>
            </div>
            <input name="monthEndTime" time-validate ='month' ng-model="translate.endTime"  type="month" start-time="translate.startTime" ng-switch-when="3" required>
            <div ng-messages="stForm.monthEndTime.$error">
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">{{errorInfo.endTime[0]}} </div>
              <div ng-message="too-great">{{errorInfo.endTime[1]}}</div>
            </div>
            <input ng-model="translate.year.endTime"  time-validate ='year' start-time="translate.year.startTime" type="number" ng-switch-when="5" name="endYear" required>
            <div ng-messages="stForm.endYear.$error">
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">{{errorInfo.endTime[0]}}</div>
              <div ng-message="too-great">{{errorInfo.endTime[1]}}</div>
            </div>
          </md-input-container >
        </div>
    </div>
     <i class="glyphicon glyphicon-chevron-up shrinkage" ng-show = 'flagObj.close&&!stForm.$invalid' ng-click="flagObj.shoumun.flag=0"></i>
    <md-button ng-click="searchST(stForm.$invalid)" ng-disabled="stForm.$invalid" class="md-fab md-primary md-hue-1" aria-label="Profile">
     <i class="glyphicon glyphicon-arrow-down" style="margin-top:28px;" ng-show="flagObj.shoumun.flag==0"></i>
     <i class="glyphicon glyphicon-search" ng-show="flagObj.shoumun.flag==1"></i>
    </md-button>
  </div>
 </form>
  <div class="table-info" ng-switch="flagObj.flag" >
    <div >
      <div class="menus">
        <div >
          <md-button aria-label="列表"  ng-click="changeTable()"  class="md-raised ico-btn">
            <img src="images/tables.png"></md-button>
          <md-button aria-label="图表" ng-click="changeView()" class="md-raised ico-btn">
            <img src="images/charts.png"></md-button>
          <form action="{{formPrefixTable}}" ng-if = "flagObj.flag === 'table'" name = 'exportTable' target="_black" method="post" style="display: initial;">
            <input type="hidden" value="{{response.data.outData}}"  name="data" />
            <md-button  type="submit"  class="md-raised">导出Excel</md-button>
          </form>
          <form action="{{formPrefixView}}" ng-show = "flagObj.flag === 'view'" name = 'exportView' target="_black" method="post" style="display: initial;">
            <input type="hidden" value="{{response.data.outData}}"  name="data" />
            <md-button  type="submit"  class="md-raised">导出Excel</md-button>
          </form>
        </div>
      </div>
      <div ng-show="flagObj.flag === 'view'">
          <div id="sign" class="left sign" ng-class="{'sign100':clickForm.tradeTypeCode === '01'}" ng-show = "clickForm.tradeTypeCode === '01' || clickForm.tradeTypeCode === '03'"></div>
          <div id="term" class="right sign" ng-class="{'sign100':clickForm.tradeTypeCode === '02'}" ng-show = "clickForm.tradeTypeCode === '02' || clickForm.tradeTypeCode === '03'"></div>
        <div class="table-detail">
          <div class="t_r">
            <table class="table table-bordered">
              <thead>
                <tr>
                  <th width="10%">省公司</th>
                  <th width="10%" >签约总笔数</th>
                  <th width="10%" >签约占比</th>
                </tr>
              </thead>
              <tbody>
                <tr ng-repeat="item in response.data.chartData">
                  <td width="10%"  >{{item.provinceName}}</td>
                  <td width="10%">{{item.signNum}}</td>
                  <td width="10%">{{item.signRate.toFixed(4)}}%</td>
                </tr>
                <tr class='summary'>
                  <td width="10%" >汇总</td>
                  <td width="10%" >{{response.data.signRateNum}}</td>
                  <td width="10%" ></td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
      <div ng-switch-when="table">
        <div style="text-align: center">
          <h4 style="margin-top:0;font-size:large;font-weight:bold;color:black">{{response.data.title.titleTime}}&nbsp;{{response.data.title.tradeTypeName}}统计</h4>
        </div>
        <div class="table-detail">
          <div class="t_r">
            <table class="table table-bordered">
              <thead>
                <tr>
                  <th width="10%">账期</th>
                  <th width="10%">银行</th>
                  <th width="10%">省公司</th>
                  <th width="15%">接入渠道</th>
                  <th width="10%">交易类型</th>
                  <th width="10%">签约笔数</th>
                </tr>
              </thead>
              <tbody>
                <tr ng-repeat="item in response.data.signData">
                  <td width="10%" title = "{{item.stDate}}">{{item.stDate}}</td>
                  <td width="10%" >{{item.bankName}}</td>
                  <td width="10%" >{{item.provinceName}}</td>
                  <td width="15%" class="table-ellipsis" title = "{{item.signChannelName}}" >{{item.signChannelName}}</td>
                  <td width="10%" >{{response.data.title.tradeTypeName}}</td>
                  <td width="10%" >{{item.signNum}}</td>
                </tr>
                <tr class='summary'>
                  <td width="10%">汇总</td>
                  <td width="10%"></td>
                  <td width="10%"></td>
                  <td width="15%"></td>
                  <td width="10%"></td>
                  <td width="10%">{{response.data.signNum}}</td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
      <div ng-if='flagObj.flag === "table"'>
        <ds-page
           total-count= 'response.data.totalCount'
           page-size='params.page.pageSize'
           page-itmes='pageItmes'
           current-page= 'params.page.currentPage'
           param = 'params'
           go-page="pageQuery(params)"
           page-size-change="pageSizeChange(params.page.pageSize)"
           show-max-page="5"
           first-text="<<"
           last-text=">>"
           previous-text="<"
           next-text=">">
        </ds-page>
      </div>
    </div>
  </div>
</div>
